/**
 * @Date: Feb 18, 2010 7:35:19 PM
 */
package com.philip.journal.core.controller.spring;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.HttpRequestHandler;

/**
 * @author cry30
 */
public abstract class BaseServletSpring extends HttpServlet implements HttpRequestHandler { // NOPMD by r39

    /**
     * Method required by spring to allow dependency injection to servlets. Will force sub classes to
     * implement service so the delegate from handleRequest to service will work.
     *
     * @param request - standard servlet request instance.
     * @param response - standard servlet response instance.
     * @throws ServletException - standard servlet exception adapted by the spring interface.
     * @throws IOException - standard servlet exception adapted by the spring interface.
     *
     */
    @Override
    public void handleRequest(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {
        service(request, response);
    }

    @Override
    public abstract void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException;
}
